package com.hex.ds.hdrs.common.excel;

import com.hex.ds.hdrs.common.constant.Const;
import org.apache.commons.lang3.StringUtils;

/**
 * @author lwz
 * @date 2021-01-29
 * @des
 */
public class DownCycleJobExcelHelper {

    public static String getJobPeriod(String jobPeriod,String dateExpression){
        if ("D".equals(jobPeriod)){
           return "日";
        }
        if (StringUtils.isNotBlank(jobPeriod) && StringUtils.isNotBlank(dateExpression)){
            return getJobPeriod2(jobPeriod,dateExpression);
        }
        if ("W".equals(jobPeriod)){
            return "周";
        }
        if ("X".equals(jobPeriod)){
            return "旬";
        }
        if ("M".equals(jobPeriod)){
            return "月";
        }
        if ("Q".equals(jobPeriod)){
            return "季";
        }
        if ("Y".equals(jobPeriod)){
            return "年";
        }
        return "未知";
    }

    private static String getJobPeriod2(String jobPeriod,String dateExpression){
        return jobPeriod + "[" + dateExpression + "]";
    }

    public static String getJobStatus(String jobStatus){
        if (Const.UNPUBLISHED.equals(jobStatus)){
            return "未发布";
        }
        if (Const.EABLE.equals(jobStatus)){
            return "启用";
        }
        if (Const.UNENABLE.equals(jobStatus)){
            return "停用";
        }
        return "未知";
    }
}
